#include"commm.hpp"
#include<string.h>

int main(){
    key_t k = getkey();
    int ret = revecemsg(k);//返回的是读的文件描述数
    //cout<<"client ret :"<<ret<<endl;

    struct msgbuf buffer;
    memset(&buffer,0,sizeof(buffer));//清0
    
    //输出型参数
    while(true){
        msgrcv(ret,&buffer,sizeof buffer,1,0);
        cout<<"读取到了："<<buffer.mtext<<endl;
        sleep(1);
    }

    msgctl(ret,IPC_RMID,0);


    return 0;
}